/*
 *
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License version 2 as 
 * published by the Free Software Foundation.
 *
 * test_seq_list.cpp is for what ...
 *
 * Version: ***: test_seq_list.cpp  Mon Oct 10 22:51:25 2011 poponion Exp $
 *
 * Authors:
 *   Author poponion
 *          Email: huangcm85@gmail.com
 *          Blog : http://www.poponion.info
 *     -some work detail if you want 
 *
 */

#include "datastruct/seq_list.h"
#include <gtest/gtest.h>
#include <stdio.h>

namespace poponion
{
  namespace datastruct
  {
    TEST(SEQLIST, basic)
    {
      SeqList<int> slist;
      int ret = slist.init(100, 2);
      EXPECT_EQ(MY_SUCCESS, ret);
      EXPECT_EQ(100, slist.capacity());
      EXPECT_EQ(0, slist.length());

      for(int index = 0; index < 100; ++index)
      {
        ret = slist.insert(index);
        EXPECT_EQ(MY_SUCCESS, ret);
        EXPECT_EQ(index+1, slist.length());
        EXPECT_EQ(100, slist.capacity());
      }
      ret = slist.insert(101);
      EXPECT_EQ(200, slist.capacity());
      EXPECT_EQ(101, slist.length());
    }
  }
}
int main(int argc, char* argv[])
{
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();  
}
